import {post_json,get,post} from '../../http/axios.js'
export default {
    namespaced:true,
    state:{
        money:[],
        recharge:{},
        allmoney:'',
        moneyData:{}
    },
    getters:{
        newList(state){
            let sum = 0
            let res = state.money.map((item)=>{
                sum = sum+Number(item.money)
            })
            
            return sum
        },
    },
    mutations:{
        setMoney(state,data){
            state.money = data
        },
        setrecharge(state,data){
            state.recharge=data
        },
        setall(state,data){
            state.allmoney
        },
        setMoneyData(state,data){
            state.moneyData=data
        }
      
    },
    actions:{
        async toLoadMoneyData(context,params){
            let res = await get('/waiter/findWaiterById?id='+params)
            context.commit('setMoneyData',res.data)
        },
        async toLoadMoney(context,params){
            let res = await get('/waiter/detailsShou?id='+params)
            context.commit('setMoney',res.data)
        },
        async Loadrecharge(context,params){
            let res = await get('/customer/recharge',params)
        }
       
    }
}